package com.tsu.mall.order.service.impl;

import com.tsu.mall.order.entity.MemberAddress;
import com.tsu.mall.order.mapper.MemberAddressMapper;
import com.tsu.mall.order.service.IMemberAddressService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author tttttt
 * @since 2023-04-07
 */
@Service
public class MemberAddressServiceImpl extends ServiceImpl<MemberAddressMapper, MemberAddress> implements IMemberAddressService {


    @Override
    public List<MemberAddress> selectMemberAddressByCurrentMemberId(Integer id) {
        return baseMapper.selectMemberAddressByCurrentMemberId(id);
    }

    @Override
    public MemberAddress selectMemberAddressByAddressId(Integer addressId) {
        return baseMapper.selectMemberAddressByAddressId(addressId);
    }

    @Override
    public void updateMemberAddressByAddressId(Integer addressId) {
         baseMapper.updateMemberAddressByAddressId(addressId);//默认地址改为是
        baseMapper.updateMemberAddress(addressId);//其他默认地址改为否
    }
}
